package com.hos.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @author ：张家琪
 * @date ：Created in 2023/12/8 14:54
 * @description：
 * @modified By：
 * @version:
 */
public class WebUtil {
    public static HttpServletRequest getRequest() {
        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        return servletRequestAttributes.getRequest();
    }

    /**
     * @create by: 陈海彬
     * @description: 获取登录的token
     * @create time: 2023/12/8 15:49
     */
    public static String getToken() {
        return WebUtil.getRequest().getHeader("token");
    }
}